// type User = {
//   name?: string,
//   sex?: string,
//   age?: number
// }

// type User = {
//   name: string
//   age: number
//   [key: string]: string | number
// }

// // 对象的键，可以是string，number和symbol类型
// let obj: User = {
//   name: "jack",
//   sex: "男",
//   age: 20,
//   "123": "hello",
// }

// console.log(obj.age)

type AnyTypeObj = {
  [key: string]: any
}

let obj: AnyTypeObj = {};
obj.age = 10;
obj.name = "jack";

interface CatInfo {
  age: number;
  breed: string;
}

type CatName = "miffy" | "boris" | "mordred";
 
const cats: Record<CatName, CatInfo> = {
  miffy: { age: 10, breed: "Persian" },
  boris: { age: 5, breed: "Maine Coon" },
  mordred: { age: 16, breed: "British Shorthair" },
};

const user: Record<string, any> = {
  id: 1,
  name: "jack",
  show:()=>console.log("hello")
}